package com.ll.stringdemo;


/**
 * @author 刘龙
 * @version 1.0
 */
public class StringExercise05 {
    public static void main(String[] args) {
        Person p1 = new Person();
        p1.name = "java";
        Person p2 = new Person();
        p2.name = "java";

        // true
        System.out.println(p1.name.equals(p2.name));
        // true
        System.out.println(p1.name == p2.name);
        // true
        System.out.println(p1.name == "java");

        String s1 = new String("abc");
        String s2 = new String("abc");
        // false
        System.out.println(s1 == s2);
    }
}

class Person {
    public String name;
}
